﻿using System;
using CoreRay;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace CoreRay.Testing
{
    /// <summary>
    /// This is a test class for GeometryBufferTest and is intended
    /// to contain all GeometryBufferTest Unit Tests
    /// </summary>
    [TestClass]
    public class GeometryBufferTest
    {
      
        /// <summary>
        /// Setup method used for the tests.
        /// </summary>
        /// <returns>Test GeometryBuffer.</returns>
        private GeometryBuffer SetupGeometryBuffer()
        {
            // Init vertex format
            VertexFormat vertexFormat = new VertexFormat();
            vertexFormat.AddElement("Position", typeof(Vector3));

            // Init geometry buffer
            GeometryBuffer geometryBuffer = new GeometryBuffer(vertexFormat);

            // Init vertex buffer
            geometryBuffer.VertexBuffer.Write(new Vector3(5, 6, 2));
            geometryBuffer.VertexBuffer.Write(new Vector3(-97, 23, 25));
            geometryBuffer.VertexBuffer.Write(new Vector3(57, 68, 147));

            geometryBuffer.VertexBuffer.Write(new Vector3(0, 0, 0));
            geometryBuffer.VertexBuffer.Write(new Vector3(0, 1, 0));
            geometryBuffer.VertexBuffer.Write(new Vector3(1, 1, 0));

            // Init index buffer
            geometryBuffer.IndexBuffer.Write(0);
            geometryBuffer.IndexBuffer.Write(1);
            geometryBuffer.IndexBuffer.Write(2);

            geometryBuffer.IndexBuffer.Write(3);
            geometryBuffer.IndexBuffer.Write(4);
            geometryBuffer.IndexBuffer.Write(5);

            return geometryBuffer;
        }
    }
}
